#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QHelpEngine>
#include <QTextBrowser>
#include <QHelpLink>
#include <QApplication>
#include <QHelpEngine>
#include <QHelpContentWidget>
#include <QHelpIndexWidget>
#include <QTextEdit>
#include <QVBoxLayout>
#include <QWidget>
#include <QDockWidget>
#include <QTabWidget>
#include <QSplitter>
#include <QUrl>
#include <QDebug>
#include <QPushButton>
#include <QLibraryInfo>



void MainWindow::exec()
{
    i++;
    if (i > 3) {
        i = 1;
    }

    QString index = QString("qthelp://bmseven.myHelp/doc/section%1.html").arg(i);
    helpEngine->contentWidget()->linkActivated(index);
}

MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{

    // 创建主界面
    QWidget *centralWidget = new QWidget(this);
    QVBoxLayout *layout = new QVBoxLayout(centralWidget);

    // 添加帮助按钮
    QPushButton *helpButton = new QPushButton("帮助文档", this);
    layout->addWidget(helpButton);

    setCentralWidget(centralWidget);

    // 连接按钮信号
    connect(helpButton, &QPushButton::clicked, this, &MainWindow::showHelp);
}

MainWindow::~MainWindow()
{
    delete ui;
}
